// ==UserScript==
// @name 【智狐】全网VIP视频解析无广告播放,支持B站大会员番剧、视频批量下载,全网独创自由选择自动解析接口|短视频无水印下载|淘宝、天猫、京东优惠券查询|更多功能持续更新中
// @namespace http://www.zhihupe.com/
// @version 0.68
// @author zhihu
// @description 【❤️ 视频自动解析,体会拥有VIP的感觉❤️,适配PC+移动 】功能有:1、支持B站大会员番剧,全网独创自由选择自动解析接口;2、爱奇艺、腾讯、优酷、芒果等全网VIP视频免费解析去广告(免跳出观影特方便);3.B站多P下载;抖音、西瓜视频、快手无水印下载;4.淘宝、天猫、京东优惠券查询5.新增喜马拉雅有声书批量下载
// @icon https://www.zhihupe.com/favicon.ico
// @require https://lf26-cdn-tos.bytecdntp.com/cdn/expire-1-M/crypto-js/4.1.1/crypto-js.min.js
// @match *://laisoyiba.com/*
// @match *://*.youku.com/v_*
// @match *://*.iqiyi.com/v_*
// @match *://*.iqiyi.com/w_*
// @match *://*.iqiyi.com/a_*
// @match *://v.qq.com/x/cover/*
// @match *://v.qq.com/x/page/*
// @match *://v.qq.com/tv/*
// @match *://*.mgtv.com/b/*
// @match *://*.bilibili.com/video/*
// @match *://*.bilibili.com/bangumi/play/*
// @match *://www.le.com/ptv/vplay/*
// @match *://m.v.qq.com/*
// @match *://m.iqiyi.com/v_*
// @match *://m.iqiyi.com/w_*
// @match *://m.iqiyi.com/a_*
// @match *://m.youku.com/alipay_video/*
// @match *://m.youku.com/video/*
// @match *://m.mgtv.com/b/*
// @match *://m.bilibili.com/video/*
// @match *://m.bilibili.com/anime/*
// @match *://m.bilibili.com/bangumi/play/*
// @match *://m.le.com/vplay_*
// @match *://item.taobao.com/*
// @match *://*detail.tmall.com/*
// @match *://*detail.tmall.hk/*
// @match *://*item.jd.com/*
// @match *://npcitem.jd.hk/*
// @match *://*.yiyaojd.com/*
// @match *://www.ximalaya.com/*
// @match *://*.douyin.com/video/*
// @match *.kuaishou.com/short-video/*
// @match *.kuaishou.com/video/*
// @match *.ixigua.com/*
// @connect tool.zhihupe.com
// @connect 47.99.158.118
// @connect api.bilibili.com
// @connect mobile.ximalaya.com
// @grant GM_xmlhttpRequest
// @grant GM.xmlHttpRequest
// @grant GM_openInTab
// @grant GM_addStyle
// @grant GM_setValue
// @grant GM_getValue
// @grant GM_deleteValue
// @grant GM_setClipboard
// @grant GM_download
// @grant unsafeWindow
// @run-at document-body
// @license End-User License Agreement
// @antifeature referral-link 【此提示为GreasyFork代码规范要求含有查券功能的脚本必须添加,实际使用无任何强制跳转,代码可查,请知悉】
// ==/UserScript==
(function() {
'use strict';
//最终用户许可协议 End-User License Agreement
// * Copyright (c) 2021-2022 zhihu. All Rights Reserved.
// * Proprietary and Confidential.
// * 该项目介绍、说明书、脚本代码、思路及其他相关
// 内容版权归作者所有,未经作者本人书面授权,禁
// 止任何单位或个人以任何形式、任何手段或通过任
// 何方式(净室工程、手工、图片、电子、机械、磁
// 性、化学、光学、声学或其它方式)抄袭、摘编、
// 编辑、修改、结集、出版、再版、转录、转载、爬
// 虫爬取、重制、仿制、复制、复写、复印、影印、
// 拷贝、刻录、建立镜像、粘贴、张贴、派发、录音、
// 用来创建派生作品、与其它任何资料进行合并、翻
// 译成任何电脑语言或以其他任何方式用于商业或公
// 共目的。
// * 该项目仅仅准许您善意的使用,其他任何行为都是
// 禁止的。
// * zhihu从未授权任何组织或个人使用本项目脚本
// 部分或全部代码创建作品。
var Insidehtml = "";
var Outsidehtml = "";
var selecthtml = "";
var mobhtml = "";
var PlayID = "";
var jiexi;
var playhref = window.location.href;
var host = window.location.host;
var goodid = "";
var method, action, qrname, nodeid,videoid;
var UA = navigator.userAgent;
const scriptInfo = GM_info.script;
const author = scriptInfo.author;
if (host.indexOf('m.') > -1) {
var com = "wap";
} else {
com = "pc";
}
const playList=[
{"id":"9","name":"M3U8.TV","category":1,"url":"https://jx.m3u8.tv/jiexi/?url=", "showType":3},
{"id":"55","name":"纯净/B站","category":1,"url":"https://z1.m1907.cn/?jx=", "showType":3},
{"id":"2","name":"高速接口","category":1,"url":"https://jsap.attakids.com/?url=", "showType":3},
{"id":"3","name":"综合/B站","category":1,"url":"https://vip.parwix.com:4433/player/?url=", "showType":3},
{"id":"4","name":"OK解析","category":1,"url":"https://okjx.cc/?url=", "showType":3},
{"id":"1","name":"618g","category":1,"url":"https://jx.618g.com/?url=", "showType":3},
{"id":"5","name":"夜幕","category":1,"url":"https://www.yemu.xyz/?url=", "showType":3},
{"id":"6","name":"乐多资源","category":1,"url":"https://api.leduotv.com/wp-api/ifr.php?isDp=1&vid=", "showType":3},
{"id":"7","name":"爱豆","category":1,"url":"https://jx.aidouer.net/?url=", "showType":1},
{"id":"8","name":"虾米","category":1,"url":"https://jx.xmflv.com/?url=", "showType":1},
{"id":"10","name":"人人迷","category":1,"url":"https://jx.blbo.cc:4433/?url=", "showType":3},
{"id":"11","name":"全民","category":1,"url":"https://jx.blbo.cc:4433/?url=", "showType":3},
{"id":"12","name":"七哥","category":1,"url":"https://jx.mmkv.cn/tv.php?url=", "showType":3},
{"id":"13","name":"冰豆","category":1,"url":"https://api.qianqi.net/vip/?url=", "showType":3},
{"id":"14","name":"迪奥","category":1,"url":"https://123.1dior.cn/?url=", "showType":1},
{"id":"15","name":"CK","category":1,"url":"https://www.ckplayer.vip/jiexi/?url=", "showType":1},
{"id":"16","name":"游艺","category":1,"url":"https://api.u1o.net/?url=", "showType":1},
{"id":"17","name":"LE","category":1,"url":"https://lecurl.cn/?url=", "showType":1},
{"id":"18","name":"ckmov","category":1,"url":"https://www.ckmov.vip/api.php?url=", "showType":1},
{"id":"19","name":"playerjy/B站","category":1,"url":"https://jx.playerjy.com/?url=", "showType":3},
{"id":"20","name":"ccyjjd","category":1,"url":"https://ckmov.ccyjjd.com/ckmov/?url=", "showType":1},
{"id":"21","name":"爱豆","category":1,"url":"https://jx.aidouer.net/?url=", "showType":1},
{"id":"22","name":"诺诺","category":1,"url":"https://www.ckmov.com/?url=", "showType":1},
{"id":"23","name":"H8","category":1,"url":"https://www.h8jx.com/jiexi.php?url=", "showType":1},
{"id":"24","name":"BL","category":1,"url":"https://vip.bljiex.com/?v=", "showType":1},
{"id":"25","name":"解析la","category":1,"url":"https://api.jiexi.la/?url=", "showType":1},
{"id":"26","name":"MUTV","category":1,"url":"https://jiexi.janan.net/jiexi/?url=", "showType":1},
{"id":"27","name":"MAO","category":1,"url":"https://www.mtosz.com/m3u8.php?url=", "showType":1},
{"id":"28","name":"老板","category":1,"url":"https://vip.laobandq.com/jiexi.php?url=", "showType":1},
{"id":"29","name":"盘古","category":1,"url":"https://www.pangujiexi.cc/jiexi.php?url=", "showType":1},
{"id":"30","name":"盖世","category":1,"url":"https://www.gai4.com/?url=", "showType":1},
{"id":"31","name":"小蒋","category":1,"url":"https://www.kpezp.cn/jlexi.php?url=", "showType":1},
{"id":"32","name":"YiTV","category":1,"url":"https://jiexi.us/?url=", "showType":1},
{"id":"33","name":"星空","category":1,"url":"http://60jx.com/?url=", "showType":1},
{"id":"34","name":"0523","category":1,"url":"https://go.yh0523.cn/y.cy?url=", "showType":1},
{"id":"35","name":"17云","category":1,"url":"https://www.1717yun.com/jx/ty.php?url=", "showType":1},
{"id":"36","name":"4K","category":1,"url":"https://jx.4kdv.com/?url=", "showType":1},
{"id":"37","name":"云析","category":1,"url":"https://jx.yparse.com/index.php?url=", "showType":1},
{"id":"38","name":"8090","category":1,"url":"https://www.8090g.cn/?url=", "showType":1},
{"id":"39","name":"江湖","category":1,"url":"https://api.jhdyw.vip/?url=", "showType":1},
{"id":"40","name":"诺讯","category":1,"url":"https://www.nxflv.com/?url=", "showType":1},
{"id":"41","name":"PM","category":1,"url":"https://www.playm3u8.cn/jiexi.php?url=", "showType":1},
{"id":"42","name":"奇米","category":1,"url":"https://qimihe.com/?url=", "showType":1},
{"id":"43","name":"思云","category":1,"url":"https://jx.ap2p.cn/?url=", "showType":1},
{"id":"44","name":"听乐","category":1,"url":"https://jx.dj6u.com/?url=", "showType":1},
{"id":"45","name":"aijx","category":1,"url":"https://jiexi.t7g.cn/?url=", "showType":1},
{"id":"46","name":"52","category":1,"url":"https://vip.52jiexi.top/?url=", "showType":1},
{"id":"47","name":"黑米","category":1,"url":"https://www.myxin.top/jx/api/?url=", "showType":1},
{"id":"48","name":"豪华啦","category":1,"url":"https://api.lhh.la/vip/?url=", "showType":1},
{"id":"49","name":"凉城","category":1,"url":"https://jx.mw0.cc/?url=", "showType":1},
{"id":"50","name":"33t","category":1,"url":"https://www.33tn.cn/?url=", "showType":1},
{"id":"51","name":"180","category":1,"url":"https://jx.000180.top/jx/?url=", "showType":1},
{"id":"52","name":"无名","category":1,"url":"https://www.administratorw.com/video.php?url=", "showType":1},
{"id":"53","name":"黑云","category":1,"url":"https://jiexi.380k.com/?url=", "showType":1},
{"id":"54","name":"九八","category":1,"url":"https://jx.youyitv.com/?url=", "showType":1},
{"id":"56","name":"综合线路","category":2,"url":"https://laisoyiba.com/mov/s/?sv=3&url=", "showType":1},
{"id":"57","name":"纯净/B站","category":2,"url":"https://z1.m1907.cn/?jx=", "showType":1},
{"id":"58","name":"高速接口","category":2,"url":"https://jsap.attakids.com/?url=", "showType":1},
{"id":"59","name":"综合/B站1","category":2,"url":"https://vip.parwix.com:4433/player/?url=", "showType":1},
{"id":"60","name":"OK解析","category":2,"url":"https://okjx.cc/?url=", "showType":1},
{"id":"61","name":"夜幕","category":2,"url":"https://www.yemu.xyz/?url=", "showType":1},
{"id":"62","name":"虾米","category":2,"url":"https://jx.xmflv.com/?url=", "showType":1},
{"id":"63","name":"全民","category":2,"url":"https://jx.quanmingjiexi.com/?url=", "showType":1},
];
function Toast(msg, duration = 3000) {
var m = document.createElement('div');
m.innerHTML = msg;
m.setAttribute('id','msg');
m.style.cssText = "max-width:60%;min-width: 150px;padding:0 14px;min-height: 40px;color: rgb(255, 255, 255);line-height: 40px;text-align: center;border-radius: 4px;position: fixed;top: 50%;left: 50%;transform: translate(-50%, -50%);z-index: 999999;background: rgba(0, 0, 0,.7);font-size: 16px;";
document.body.appendChild(m);
setTimeout(() => {
var d = 0.5;
m.style.webkitTransition = '-webkit-transform ' + d + 's ease-in, opacity ' + d + 's ease-in';
m.style.opacity = '0';
setTimeout(() => { document.body.removeChild(document.querySelector("#msg")) }, d * 1000);
}, duration);
}
function GMiosgetValue(name) {
if(UA.indexOf('iPhone') > -1||host.indexOf('m.iqiyi.com') > -1){
var StorageValue = localStorage.getItem(name);
}else{
StorageValue = GM_getValue(name);
}
return StorageValue;
}
function GMiossetValue(name, Value) {
if(UA.indexOf('iPhone') > -1||host.indexOf('m.iqiyi.com') > -1){
localStorage.setItem(name, Value);
}else{
GM_setValue(name, Value);
}
}
function GMsetValue(name, Value) {
localStorage.setItem(name, Value);
}
function GMgetValue(name) {
let StorageValue = localStorage.getItem(name);
return StorageValue;
}
function GMdeleteValue(name) {
localStorage.removeItem(name);
}
function GMaddStyle(css) {
var addStyle = document.createElement('style');
addStyle.textContent = css;
var doc = document.head || document.documentElement;
doc.appendChild(addStyle);
};
function GMaddScript(js) {
let script = document.createElement('script');
script.src = js;
var docu = document.head || document.documentElement;
docu.appendChild(script);
};
function GMaddlink(linkcss) {
let mylink = document.createElement('link');
mylink.href = linkcss;
mylink.rel = 'stylesheet';
var docl = document.head || document.documentElement;
docl.appendChild(mylink);
};
function GMopenInTab(url, open_in_background) {
if (typeof GM_openInTab === "function") {
GM_openInTab(url, open_in_background);
} else {
GM.openInTab(url, open_in_background);
}
};
function Addjs() {
GMaddScript("https://www.layuicdn.com/layui/layui.js");
GMaddlink("https://www.layuicdn.com/layui/css/layui.css");
}
if(GMiosgetValue("isuser") == 1){
switch (host) {
case 'v.qq.com':
PlayID = "#mod_player";
Addjs();
addbtn();
GMsetValue("playwork","1")
console.log('已进入腾讯');
setInterval(function() {
let e = document.querySelector("#mask_layer");
if (e != null) e.parentNode.removeChild(e);
let f = document.querySelector(".mod_vip_popup");
if (f != null) f.parentNode.removeChild(f);
},
100);
break;
case 'v.youku.com':
Addjs();
PlayID = "#player";
addbtn();
console.log('已进入优酷')
break;
case 'www.iqiyi.com':
Addjs();
PlayID = "#flashbox";
addbtn();
GMsetValue("playwork","1")
console.log('已进入爱奇艺')
break;
case 'www.mgtv.com':
Addjs();
PlayID = "#mgtv-player-wrap";
addbtn();
GMsetValue("playwork","1")
console.log('已进入芒果TV')
break;
case 'www.bilibili.com':
Addjs();
PlayID = "#player_module";
if (playhref.indexOf("www.bilibili.com/bangumi/play") != -1) {
addbtn();
GMsetValue("playwork","1")
}
var Bv = null;
var pathname = window.location.pathname;
if (pathname.indexOf("/medialist/play/watchlater/") != -1) {
Bv = pathname.replace("/medialist/play/watchlater/","").replace("/","");
}else{
Bv = pathname.replace("/video/","").replace("/","");
}
console.log(Bv)
if(Bv!=null){
Getaid(Bv);
}
console.log('已进入bilibili')
break;
case 'www.le.com':
Addjs();
PlayID = "#le_playbox";
addbtn();
GMsetValue("playwork","1")
console.log('已进入乐视TV')
break;
case 'laisoyiba.com':
setInterval(function() {
let e = document.querySelector(".jconfirm-scrollpane");
if (e != null) e.parentNode.removeChild(e);
},
100);
break;
case 'm.v.qq.com':
if(playhref.indexOf('/play') > -1){
PlayID = "#player";
addmobbtn();
GMsetValue("playwork","1")
setInterval(function() {
let e = document.querySelector("#vipPosterContent");
if (e != null) e.parentNode.removeChild(e);
let f = document.querySelector(".at-app-banner");
if (f != null) f.parentNode.removeChild(f);
},
100);
console.log('已进入手机腾讯');
}
break;
case 'm.youku.com':
PlayID = "#player";
setInterval(function() {
let e = document.querySelector(".callEnd_box");
if (e != null) e.parentNode.removeChild(e);
},
100);
addmobbtn();
console.log('已进入手机优酷');
break;
case 'm.iqiyi.com':
PlayID = ".m-video-player-wrap";
addmobbtn();
GMsetValue("playwork","1")
console.log('已进入手机爱奇艺');
break;
case 'm.mgtv.com':
PlayID = ".video-area";
setInterval(function() {
let e = document.querySelector(".mg-down-btn");
if (e != null) e.parentNode.removeChild(e);
let f = document.querySelector(".ad-fixed-bar");
if (f != null) f.parentNode.removeChild(f);
},
100);
addmobbtn();
GMsetValue("playwork","1")
console.log('已进入手机芒果TV');
break;
case 'm.bilibili.com':
PlayID = "#bofqi";
if (playhref.indexOf("m.bilibili.com/bangumi/play") != -1) {
addmobbtn();
GMsetValue("playwork","1")
}
console.log('已进入手机bilibili');
break;
case 'm.le.com':
PlayID = "#j-player";
setInterval(function() {
document.querySelector("#j-player").style.display = "block";
let e = document.querySelector("#j-vipLook");
if (e != null) e.parentNode.removeChild(e);
let f = document.querySelector(".daoliu1");
if (f != null) f.parentNode.removeChild(f);
},
100);
addmobbtn();
GMsetValue("playwork","1")
console.log('已进入手机乐视TV');
break;
case 'item.taobao.com':
qrname = "淘宝";
nodeid = "#J_PromoPrice";
goodid = Getgoodid("id");
method = "taobao";
action = "getlink";
Getcoupon(goodid);
console.log(goodid);
console.log('已进入淘宝');
break;
case 'detail.tmall.com':
qrname = "淘宝";
nodeid = "#J_PromoPrice";
goodid = Getgoodid("id");
method = "taobao";
action = "getlink";
Getcoupon(goodid);
console.log(goodid);
console.log('已进入天猫');
break;
case 'item.yiyaojd.com':
qrname = "京东";
nodeid = "#J-summary-top";
goodid = geturlid(playhref);
method = "jd";
action = "getdetails";
Getcoupon(goodid);
console.log(goodid) ;
console.log('已进入京东医药');
break;
case 'item.jd.com':
qrname = "京东";
nodeid = "#J-summary-top";
goodid = geturlid(playhref);
method = "jd";
action = "getdetails";
Getcoupon(goodid);
console.log(goodid);
console.log('已进入京东');
break;
case 'npcitem.jd.hk':
qrname = "京东";
nodeid = "#J-summary-top";
goodid = geturlid(playhref);
method = "jd";
action = "getdetails";
Getcoupon(goodid);
console.log(goodid);
console.log('已进入京东国际');
break;
case 'www.douyin.com':
console.log('已进入抖音') ;
nodeid =".xg-right-grid"
videoid = geturlid(playhref);
douyinbtn(videoid);
console.log(geturlid(playhref))
break;
case 'www.kuaishou.com':
console.log('已进入快手') ;
nodeid =".right"
videoid = geturlid(playhref);
kuaishoubtn(videoid);
console.log(geturlid(playhref))
break;
case 'www.ixigua.com':
console.log('已进入西瓜视频') ;
nodeid =".video_action"
videoid = geturlid(playhref);
window.onload=function() {
xiguabtn(videoid);
}
GMsetValue("playwork","1")
console.log(geturlid(playhref))
break;
case 'www.ximalaya.com':
Addjs();
console.log('已进入喜马拉雅') ;
addximalaya();
break;
}
}else{
let userhtml = '';
if(com == "wap"){
var btncss="margin: 0 20px;";
var tybtncss="width: 130px;"
}else{
btncss="margin: 0 90px;";
tybtncss="width: 180px;"
}
userhtml += '
脚本使用协议
'
userhtml += ''
userhtml +='
感谢您对本脚本的信任,为了更好的使用本脚本,在此,我们郑重提醒您:
'
userhtml +='
1.有能力的情况,请大家支持正版
'
userhtml +='
2.本脚本仅用学习交流,请勿用于非法、商业用途,使用本脚本下载的内容请勿进行复制、传播等侵权行为
'
userhtml +='
3.VIP视频解析中所用到的解析接口全部收集自互联网(源码可见),版权问题请联系相关解析接口所有者,脚本不承担相关责任
'
userhtml +='
4.视频下载内容均来自平台本身API接口,不存在破解情况,如果侵权请邮件(188872170@qq.com)联系删除。
'
userhtml +='
5.点击我同意后,即已代表您已经充分了解相关问题,否则后果自负,特此声明!
'
userhtml +='
'
console.log(userhtml)
let y = document.createElement('div');
y.setAttribute("id","user");
y.innerHTML = userhtml;
y.setAttribute("style","position: fixed;top: 50%;left: 50%;width: 480px;max-width: 80%;height: 468px;border-radius: 10px;background-image: url(https://static.hitv.com/pc/img/601d3ee.png),url(https://static.hitv.com/pc/img/21b00eb.png);background-position: 0 0,100% 280px;background-repeat: no-repeat;background-color: #fff;-webkit-box-shadow: 0 0 80px rgba(0,0,0,.25);box-shadow: 0 0 80px rgba(0,0,0,.25);opacity: 1;-webkit-transform: translate(-50%,-50%);-ms-transform: translate(-50%,-50%);transform: translate(-50%,-50%);z-index: 99999;");
document.body.appendChild(y);
document.querySelector("#ty").addEventListener('click',function() {
GMiossetValue("isuser","1");
window.location.reload();
})
document.querySelector("#bty").addEventListener('click',function() {
GMiossetValue("isuser","0");
document.body.removeChild(document.querySelector("#user"));
})
console.log(y)
}
if (GMgetValue("playwork") == 1) {
setInterval(function() {
var workurl = window.location.href;
if (playhref != workurl) {
console.log('网址改变了');
playhref = workurl;
window.location.reload()
}
},
500);
}
function CheckAutoplay() {
if (GMgetValue("AutoPlay") == 1) {
autoplay();
Toast('2秒后自动解析视频',2000);
}
}
function sleep(time) {
return new Promise(resolve => setTimeout(resolve, time));
}
function Playlist() {
for (let i = 0; i < playList.length; i++) {
if (playList[i].category == 1) {
Insidehtml += "" + playList[i].name + "";
selecthtml += ""
if (playList[i].showType == 3) {
mobhtml += "" + playList[i].name + "";
}
} else {
Outsidehtml += "" + playList[i].name + "";
}
}
console.log(mobhtml);
}
async function addmobbtn() {
await sleep(1000);
CheckAutoplay();
Playlist();
var offautohtml = '关闭自动解析'
var onautohtml = '开启自动解析'
var autohtml;
if (GMgetValue("AutoPlay") == 1) {
autohtml = offautohtml
} else {
autohtml = onautohtml
}
var mainhtml = '' + mobhtml + '
*开启自动解析后,最后一次选择的接口即自动解析默认接口
*本脚本仅学习使用,解析接口收集于网络,版权问题联系接口制作者,请勿相信解析接口显示的任何广告
'
var btnhtml = '' + mainhtml;
var mb = document.createElement('div');
mb.innerHTML = btnhtml;
document.body.appendChild(mb);
var css = `body, html {
font-family: "PingFang SC","微软雅黑","Microsoft YaHei",Helvetica,"Helvetica Neue",Tahoma,Arial,sans-serif;
}
.elevator {
position: fixed;
padding: 0 10px;
top: 80%;
margin-top: -140px;
right: 10px;
z-index: 899;
background: rgb(64 64 64 / 81%);
box-shadow: 1px 1px 8px 1px rgb(98 99 99 / 34%);
border-radius: 30px;
}
.elevator a {
position: relative;
display: block;
width: 26px;
height: 56px;
font-size: 22px;
line-height: 20px;
color: #b5b9bc;
box-sizing: border-box;
text-align: center;
}
.elevator a+a:after {
position: absolute;
top: 0;
left: 50%;
margin-left: -12px;
content: '';
width: 24px;
border: 1px solid #F3F5F7;
}
.elevator a:hover {
color: #14191e;
}
.elevator .icon {
font-size: 24px;
line-height: 56px;
color: #199b6d;
width: 28px;
height: 28px;
margin: 14px 0;
}
.elevator .icon:hover {
color: #14191e;
}
.elevator a span {
display: none;
padding: 14px 0;
font-size: 12px;
color: #fff;
line-height: 14px;
}
.elevator .elevator-msg:hover .icon,
.elevator .elevator-faq:hover .icon, {
display: none;
}
.elevator .elevator-msg:hover span,
.elevator .elevator-faq:hover span, {
display: inline-block;
}
.mob-main{
display: none;
}
.shaw{
width: 100%;
height: 100%;
position: fixed;
top: 0;
left: 0;
z-index: 99998;
background: rgba(0,0,0,0.3);
}
.listmian{
position: fixed;
width:100%;
height:400px;
bottom: 0;
z-index: 99999;
border-radius: 14px 14px 0 0;
background: #fff;
box-shadow: 0 -8px 10px 0 rgba(0,0,0,.09);
}
.listmian-tit{
background-color: #f5f5f5;
height: 60px;
line-height: 60px;
position: relative;
border-radius: 14px 14px 0 0;
}
.listmian-tit p {
color: #222;
font-size: 18px;
font-weight: 600;
margin-left: 20px;
float: left;
}
.listmian-tit .title_right {
float: right;
margin-right: 20px;
}
.listmian-tit .title_right span{
display: inline-block;
color: #222;
font-size: 14px;
vertical-align: middle;
font-weight: 900;
}
.title_right img{
display: inline-block;
width: 12px;
height: 12px;
margin-left: 3px;
vertical-align: middle;
}
.list{
margin: 10px 20px;
display:flex;
flex-direction: row;
flex-wrap: wrap;
justify-content: space-between;
height: 240px;
overflow-y: scroll;
align-content: flex-start
}
.list span{
display: inline-block;
padding: 10px 5px;
margin: 0 0 10px 0;
background-color: #f6f8fa;
border-radius: .07rem;
min-width: 90px;
text-align: center;
font-size: 12px;
line-height: 18px;
}
.jiexiselect{
color: #ff6022;
}
.tips{
margin: 5px 20px;
}
.tips span{
font-size: 12px;
font-weight: 700;
color: #333;
line-height: 14px;
}
.tips .ico{
margin-right: 5px;
color: #ff6022;
}
`;
GMaddStyle(css);
if (GMgetValue('selectid') != null) {
document.querySelector('#' + GMgetValue('selectid')).classList.add("jiexiselect");
}
document.querySelector('#playing').addEventListener('click',
function() {
autoplay();
Toast('2秒后自动解析视频',2000);
});
document.querySelector('#Showmain').addEventListener('click',function() {
document.querySelector(".mob-main").style.display = "block"
});
document.querySelector('.shaw').addEventListener('click',function() {
document.querySelector(".mob-main").style.display = "none"
})
document.querySelector('#autobtn').addEventListener('click',function() {
if (GMgetValue('AutoPlay') == 1) {
this.innerHTML = onautohtml;
GMsetValue('AutoPlay', '0');
} else {
this.innerHTML = offautohtml;
GMsetValue('AutoPlay', '1');
Toast('请选择自动解析接口',2000);
};
});
var list = document.getElementsByClassName('mob-jiexi');
for (var i in list) {
list[i].addEventListener('click',function() {
Toast('开始解析视频',2000);
if (GMgetValue('selectid') != null) {
document.querySelector('#' + GMgetValue('selectid')).classList.remove("jiexiselect");
}
var playObjecturl = this.getAttribute("data-url");
var playid = this.getAttribute("id");
console.log(playid);
GMsetValue('selectid', playid);
GMsetValue('selecturl', playObjecturl);
this.classList.add("jiexiselect");
document.querySelector(".mob-main").style.display = "none";
let url = playObjecturl + window.location.href;
console.log(url);
GoPlay(url);
})
}
}
async function addbtn() {
await sleep(1000);
CheckAutoplay();
var btnhtml = '';
var b = document.createElement('div');
b.innerHTML = btnhtml;
document.body.appendChild(b);
console.log("加载成功");
var css = `body, html {
font: 14px/1.5 "PingFang SC","微软雅黑","Microsoft YaHei",Helvetica,"Helvetica Neue",Tahoma,Arial,sans-serif;
color: #1c1f21;
height: 100%;
}
.elevator {
position: fixed;
padding: 0 16px;
top: 55%;
margin-top: -140px;
left: 0;
z-index: 9999;
background: rgb(134 134 134 / 40%);
box-shadow: 1px 1px 8px 1px rgb(98 99 99 / 34%);
border-radius: 0 8px 8px 0;
}
.elevator a {
position: relative;
display: block;
width: 26px;
height: 56px;
font-size: 22px;
line-height: 20px;
color: #b5b9bc;
box-sizing: border-box;
text-align: center;
}
.elevator a+a:after {
position: absolute;
top: 0;
left: 50%;
margin-left: -12px;
content: '';
width: 24px;
border: 1px solid #F3F5F7;
}
.elevator a:hover {
color: #14191e;
}
.elevator .icon {
font-size: 24px;
line-height: 56px;
color: #199b6d;
width: 28px;
height: 28px;
margin: 14px 0;
}
.elevator .icon:hover {
color: #14191e;
}
.elevator a span {
display: none;
padding: 14px 0;
font-size: 12px;
color: #fff;
line-height: 14px;
}
.elevator .elevator-msg:hover .icon,
.elevator .elevator-faq:hover .icon, {
display: none;
}
.elevator .elevator-msg:hover span,
.elevator .elevator-faq:hover span, {
display: inline-block;
}
.jiexi{
padding: 5px 10px;
background: #e5e5e5a3;
font-size: 12px;
border-radius: 4px;
margin:0 5px 10px 5px;
color: #505050;
display: inline-block;
width: 70px;
text-align: center;
}
.jiexiselect{
color: #fff;
background: #fc5531;
}
.scan{
width:164px;
display:inline-block;
text-align: center;
}
.scan img{
width: 140px;
margin: 0 5px 10px 5px;
}
.scan h1{
font-size: 18px;
font-weight: bold;
margin: 0px 0 20px 0;
}
.scan p{
margin: 0;
color: #666;
font-size: 14px;
}
.layui-layer-btn0{
border: 1px solid #dedede!important;
background-color: #fff!important;
color: #333!important;
}
.layui-layer-btn1{
border-color: #1E9FFF!important;
background-color: #1E9FFF!important;
color: #fff!important;
}
`;
GMaddStyle(css);
Playlist();
GMdeleteValue('selectid');
document.querySelector('#playing').onclick = function() {
autoplay();
Toast('2秒后自动解析视频',2000);
};
document.querySelector('#PlayMain').onclick = function() {
console.log("点击成功");
jiexi = GMgetValue('AutoPlay') == 1 ? "checked": "";
layer.tab({
area: ['560px', '400px'],
id: "sett2",
btn: ['取消', '保存设置'],
btnAlign: 'c',
tab: [{
title: '内嵌播放',
content: '' + Insidehtml + '
智狐百宝箱
微信扫描上方二维码
关注我
从此不迷路
'
},
{
title: '跳转播放',
content: '' + Outsidehtml + '
智狐百宝箱
微信扫描上方二维码
关注我
从此不迷路
'
},
{
title: '解析设置',
content: '智狐百宝箱
微信扫描上方二维码
关注我
从此不迷路
'
}],
btn2: function(index, layero) {
layero.find("option:selected").each(function() {
if (this.getAttribute("name") == "select") {
let selectedid = this.getAttribute("value");
let selecturl = this.getAttribute("data-url");
GMsetValue('selectedid', selectedid);
GMsetValue('selecturl', selecturl);
console.log(GMgetValue('selectedid'));
}
});
layero.find("input").each(function() {
if (this.getAttribute("name") == "switch") {
let onswitch = document.querySelector("#autoplay+div").getAttribute("class");
if (onswitch.indexOf("layui-form-onswitch") != -1) {
GMsetValue('AutoPlay', '1');
autoplay();
Toast('2秒后自动解析视频',2000);
} else {
GMsetValue('AutoPlay', '0');
}
}
});
}
});
if (GMgetValue('selectid') != null) {
document.querySelector('#' + GMgetValue('selectid')).className += " jiexiselect";
}
if (GMgetValue('selectedid') != null) {
document.querySelector('#selectjiexi').value = GMgetValue('selectedid');
}
var inList = document.getElementsByClassName('inside');
for (var i = 0; i < inList.length; i++) {
inList[i].addEventListener('click',
function() {
if (GMgetValue('selectid') != null) {
document.querySelector('#' + GMgetValue('selectid')).classList.remove("jiexiselect");
}
Toast('开始解析视频',2000);
var playObjecturl = this.getAttribute("data-url");
var playid = this.getAttribute("id");
console.log(playid);
GMsetValue('selectid', playid);
console.log(GMgetValue('selectid'));
this.className = "jiexi inside jiexiselect";
document.body.removeChild(document.querySelector(".layui-layer-tab"));
document.body.removeChild(document.querySelector(".layui-layer-shade"));
let url = playObjecturl + window.location.href;
console.log(url);
GoPlay(url);
});
}
var outList = document.getElementsByClassName('outside');
console.log(outList);
for (var u = 0; u < outList.length; u++) {
outList[u].addEventListener('click',
function() {
let playObjecturl = this.getAttribute("data-url");
let Outsideurl = playObjecturl + window.location.href;
document.body.removeChild(document.querySelector(".layui-layer-tab"));
document.body.removeChild(document.querySelector(".layui-layer-shade"));
console.log(Outsideurl);
window.open(Outsideurl);
});
}
}
}
async function autoplay() {
await sleep(1500);
var f = "";
var autoplayurl;
if (GMgetValue('selecturl') != null) {
f = GMgetValue('selecturl');
}
if (f != "") {
autoplayurl = f + window.location.href;
} else {
let defurl = playList[0].url;
console.log(defurl);
autoplayurl = defurl + window.location.href;
}
GoPlay(autoplayurl);
}
function GoPlay(e) {
let playurl = e;
var iframeDivCss = "width:100%;height:100%;"
if (host.indexOf("m.iqiyi.com") != -1) {
iframeDivCss += "position: absolute;top: 0;right: 0;bottom: 0;left: 0;"
}
var videoPlayer = "";
var PlayCount;
var PlayPromise = new Promise(function(resolve, reject){
PlayCount = setInterval(function() {
var a = document.querySelector(PlayID).children;
if(a != null ){
resolve(a);
console.log(a)
}
console.log("监听")
},1000);
});
PlayPromise.then(function(msg){
clearInterval(PlayCount);
document.querySelector(PlayID).innerHTML = "";
document.querySelector(PlayID).innerHTML = videoPlayer;
});
}
function Getgoodid(gid) {
var reg = new RegExp("(^|&)" + gid + "=([^&]*)(&|$)");
var s = window.location.search.substr(1).match(reg);
if (s != null) {
return s[2];
}
return "";
}
function geturlid(url) {
if (url.indexOf("?") != -1) {
url = url.split("?")[0]
}
if (url.indexOf("#") != -1) {
url = url.split("#")[0]
}
var text = url.split("/");
var id = text[text.length - 1];
id = id.replace(".html", "");
return id
}
function Getcoupon(t) {
if (t != "") {
GM_xmlhttpRequest({
method: "GET",
url: "http://tool.zhihupe.com/coupon/getcoupon.php?m=" + method + "&act=" + action + "&goodid=" + t,
headers: {
"Content-Type": "text/html; charset=utf-8"
},
onload: function(res) {
var json = JSON.parse(res.responseText);
var code = json.code;
console.log(json);
if (method == "taobao") {
if (code == "0") {
var longTpwd = json.data.longTpwd
var couponUrl = longTpwd.match(/https:\/\/[\d\w\.\/]+/)[0];
console.log(longTpwd);
console.log(couponUrl);
var couponInfo = json.data.couponInfo;
var couponEndTime = json.data.couponEndTime;
var actualPrice = json.data.actualPrice;
addcoupon(couponUrl, couponInfo, couponEndTime, actualPrice)
}
} else if (method == "jd") {
if (code == "0") {
var couponConditions = json.data[0].couponConditions;
var couponAmount = json.data[0].couponAmount;
var jdcouponInfo;
if (couponConditions != "") {
jdcouponInfo = "满" + couponConditions + "元减" + couponAmount + "元"
} else {
jdcouponInfo = "无门槛减" + couponAmount + "元"
}
var jdcouponEndTime = json.data[0].couponEndTime
var jdactualPrice = json.data[0].actualPrice;
var couponLink = json.data[0].couponLink;
addcoupon(couponLink, jdcouponInfo, jdcouponEndTime, jdactualPrice)
}
}
},
onerror: function(err) {
console.log(err);
}
});
} else {
console.log('商品id为空!');
}
}
function addcoupon(u, f, t, p) {
var imgurl = "http://v.zhihupe.com/enQrcode?url=" + u
var mainhtml
if (f != "" && u != "") {
mainhtml = '手机' + qrname + '扫码领取
优惠劵:' + f + '
有效期至:' + t + '
'
} else {
mainhtml = '暂无优惠券
'
}
var couponhtml = '' + mainhtml + '
';
let iCount;
let AddBiPromise = new Promise(function(resolve, reject){
iCount = setInterval(function() {
let a =document.querySelector(nodeid);
let c =a.parentNode;
if(c != null ){
resolve(c)
}
console.log("监听")
},1000);
});
AddBiPromise.then(function(c){
clearInterval(iCount);
let b = document.createElement('div');
b.innerHTML = couponhtml;
c.appendChild(b)
});
}
function Getaid(Bv){
console.log(Bv)
let BiliPromise = new Promise(function(resolve, reject){
GM_xmlhttpRequest({
url:"http://api.bilibili.com/x/web-interface/archive/stat?bvid="+Bv,
method :"GET",
headers: {
"Content-type": "application/json"
},
onload: function(res) {
let obj = JSON.parse(res.responseText);
console.log(obj);
if(obj.code ==0){
let aid = obj.data.aid;
resolve(aid);
}
},
onerror: function(err) {
console.log(err);
}
});
});
BiliPromise.then(function (aid){
GM_xmlhttpRequest({
url:"https://api.bilibili.com/x/web-interface/view?aid="+aid,
method :"GET",
headers: {
"Content-type": "application/json"
},
onload: function(res) {
let obj = JSON.parse(res.responseText);
if(obj.code == 0){
let arr = obj.data.pages;
console.log(arr);
var Bilihtml=""
for (var i = 0; i < arr.length; i++) {
Bilihtml += '';
}
addbililist(Bilihtml);
}else{
Toast("获取下载列表失败");
}
},
onerror: function(err) {
console.log(err);
}
});
})
}
function addbililist(html) {
let downhtml =''
let iCount;
let AddBiPromise = new Promise(function(resolve, reject){
iCount = setInterval(function() {
var a = document.querySelector("#danmukuBox");
if(a != null ){
resolve(a)
}
console.log("监听")
},1000);
});
AddBiPromise.then(function(msg){
clearInterval(iCount);
var b = document.createElement('div');
b.innerHTML = downhtml;
b.setAttribute("id","downBox");
b.setAttribute("class","multi-page report-wrap-module report-scroll-module");
b.style.margin = "0 0 10px 0";
msg.after(b);
bilibilidown();
});
}
function bilibilidown(){
var inu = document.querySelector("#downBox");
var b=inu.getElementsByTagName('input');
aria2set(b);
document.querySelector("#sanlian") .addEventListener('click',function() {
console.log("一键三连");
document.querySelector(".like").click();
document.querySelector(".coin").click();
});
document.querySelector("#pldown") .addEventListener('click',function() {
let passwordCode = GMgetValue("plcode");
if (passwordCode !=""&&passwordCode !=null) {
GM_xmlhttpRequest({
method: "GET",
url: "http://tool.zhihupe.com/bdwpcs.php?m=BILIBILI&author="+author+"&PWD="+passwordCode,
headers: {
"Content-Type": "text/html; charset=utf-8"
},
onload: function(res){
console.log(res.responseText)
var json=JSON.parse(res.responseText);
if(json.error == 1){
let arr =[];
b.forEach(function(element) {
if(element.checked == true){
let aid = element.getAttribute("data-aid");
let cid = element.getAttribute("data-cid");
let title = element.getAttribute("title");
let json ={
"aid": aid,
"cid": cid,
"title": title,
};
arr.push(json);
}
})
if(arr.length == 0){Toast("请选择需要下载的视频",3000)}else{
bipldown(arr);
}
}else if(json.error == -2){
let msg =json.msg
Toast(msg);
}else {
Toast('服务器请求失败,请重试!');
}
},
onerror: function(err){
Toast(err);
}
});
}else {
Toast('请在脚本设置里输入验证码!');
}
});
let biliList = document.getElementsByClassName('bilidown');
console.log(biliList);
for (var i = 0; i < biliList.length; i++) {
biliList[i].addEventListener('click',function() {
let aid = this.getAttribute("data-aid");
let cid = this.getAttribute("data-cid");
let title = this.getAttribute("title");
GM_xmlhttpRequest({
url:"https://api.bilibili.com/x/player/playurl?avid="+aid+"&cid="+cid+"&qn=112",
method :"GET",
headers: {
"Content-type": "application/json"
},
onload: function(res) {
let obj = JSON.parse(res.responseText);
if(obj.code == 0){
window.open(obj.data.durl[0].url);
console.log(obj)
}else{
Toast("获取下载链接失败");
}
},
onerror: function(err) {
console.log(err);
}
});
});
}
}
function bipldown(a){
let pldownarr=[];
for (var i = 0; i < a.length; i++) {
let title =i+1+"."+a[i].title+".flv";
GM_xmlhttpRequest({
url:"https://api.bilibili.com/x/player/playurl?avid="+a[i].aid+"&cid="+a[i].cid+"&qn=112",
method :"GET",
headers: {
"Content-type": "application/json"
},
onload: function(res) {
let obj = JSON.parse(res.responseText);
if(obj.code == 0){
// window.open(obj.data.durl[0].url);
// addUri(obj.data.durl[0].url,title)
let json ={
"url": obj.data.durl[0].url,
"title":title.replace(/\//g, '-'),
};
pldownarr.push(json);
if(pldownarr.length==a.length){
console.log(pldownarr);
plaria2(-1,pldownarr);
}
console.log(obj)
}else{
Toast("获取下载链接失败");
}
},
onerror: function(err) {
console.log(err);
}
});
}
}
function addximalaya(){
if(playhref.indexOf("www.ximalaya.com/album")!= -1){
let a=document.getElementsByClassName("s_O")[1].innerText;
let b=a.replace(/[^0-9]/ig,"")
if(b<=100){
var page = 1
}else{
page =Math.ceil(b/100)
}
let albumId = geturlid(playhref);
let arr =[];
return new Promise(function(resolve, reject){recurTest(0, page,albumId,arr);
function recurTest(j,length,albumId){
setTimeout(function(){
if(++j <= length){
GM_xmlhttpRequest({
url:"https://www.ximalaya.com/revision/album/v1/getTracksList?albumId="+albumId+"&pageSize=100&pageNum="+j+"&sort=0",
method :"GET",
headers: {
"Content-type": "application/json"
},
onload: function(res) {
let obj = JSON.parse(res.responseText);
if(obj.ret == 200){
let tracks =obj.data.tracks;
arr = arr.concat(tracks)
console.log(arr)
recurTest(j, length,albumId,arr);
if(j==length){
resolve(arr)
};
}else{
Toast("获取下载列表失败");
}
},
onerror: function(err) {
console.log(err);
}
});
console.log(j, length,albumId)
}
}, Math.random() * 100);
}
}).then((listarr) => {
let downhtml=""
for (var i = 0; i < listarr.length; i++) {
downhtml += ''+listarr[i].index+'.'+listarr[i].title+'
';
}
let t =document.getElementsByClassName("xui-card")[0]
let p =t.parentNode;
let list = document.createElement('div');
list.innerHTML ='';
list.setAttribute("class","xui-card");
list.setAttribute("id","ximadown");
p.insertBefore(list,t);
console.log(p);
ximalayadown();
})
}else{
let list = document.getElementsByClassName('album-cover');
if(list!=null){
for (var i in list) {
list[i].addEventListener('click',function() {
let url =this.getAttribute("href");
const a = document.createElement('a');
document.body.appendChild(a)
a.style.display = 'none'
a.href = url;
a.target="_blank"
a.click();
window.location.reload()
})
}
}
}
}
function ximalayadown(){
var inu = document.querySelector("#downBox");
var b=inu.querySelectorAll('input');
aria2set(b);
document.querySelector("#pldown") .addEventListener('click',function() {
let passwordCode = GMgetValue("plcode");
if (passwordCode !=""&&passwordCode !=null) {
GM_xmlhttpRequest({
method: "GET",
url: "http://tool.zhihupe.com/bdwpcs.php?m=BILIBILI&author="+author+"&PWD="+passwordCode,
headers: {
"Content-Type": "text/html; charset=utf-8"
},
onload: function(res){
console.log(res.responseText)
var json=JSON.parse(res.responseText);
if(json.error == 1){
let arr =[];
b.forEach(function(element) {
if(element.checked == true){
let trackId = element.getAttribute("data-trackId");
let title = element.getAttribute("title");
let json ={
"trackId": trackId,
"title": title,
};
arr.push(json);
}
})
if(arr.length == 0){Toast("请选择需要下载的视频",3000)}else{
console.log(arr)
ximapldown(arr);
}
}else if(json.error == -2){
let msg =json.msg
Toast(msg);
}else {
Toast('服务器请求失败,请重试!');
}
},
onerror: function(err){
Toast(err);
}
});
}else {
Toast('请在脚本设置里输入验证码!');
}
});
let ximaList = document.getElementsByClassName('ximadown');
console.log(ximaList);
for (var i = 0; i < ximaList.length; i++) {
ximaList[i].addEventListener('click',function() {
let trackId = this.getAttribute("data-trackId");
let title = this.getAttribute("title");
GM_xmlhttpRequest({
url:'https://mobile.ximalaya.com/mobile-playpage/track/v3/baseInfo/'+new Date().getTime()+'?device=web&trackId='+trackId,
method :"GET",
headers: {
"Content-type": "application/json"
},
onload: function(res) {
let obj = JSON.parse(res.responseText);
console.log(obj)
if(obj.ret == 0){
let downUrl = obj.trackInfo.playUrlList[1].url;
let str1 = downUrl.replaceAll('-','+');
let str2 = str1.replaceAll('_','/');
let num = str2.length%4;
if(num){
str2 += '===='.substr(num);
}
let url = CryptoJS.AES.decrypt({
ciphertext: CryptoJS.enc.Base64.parse(str2)
}, CryptoJS.enc.Hex.parse("aaad3e4fd540b0f79dca95606e72bf93"), {
mode: CryptoJS.mode.ECB,
padding: CryptoJS.pad.Pkcs7
}).toString(CryptoJS.enc.Utf8);
console.log(url);
if(url){
GM_download(url,obj.trackInfo.title+'.mp3');
}else{
Toast('解密地址失败');
}
}else{
Toast("获取下载链接失败");
}
},
onerror: function(err) {
console.log(err);
}
});
});
}
}
function ximapldown(arr){
let pldownarr =[]
for (var i = 0; i < arr.length; i++) {
let title =i+"."+arr[i].title+".mp3";;
GM_xmlhttpRequest({
url:'https://mobile.ximalaya.com/mobile-playpage/track/v3/baseInfo/'+new Date().getTime()+'?device=web&trackId='+arr[i].trackId,
method :"GET",
headers: {
"Content-type": "application/json"
},
onload: function(res) {
let obj = JSON.parse(res.responseText);
console.log(obj)
if(obj.ret == 0){
let downUrl = obj.trackInfo.playUrlList[1].url;
let str1 = downUrl.replaceAll('-','+');
let str2 = str1.replaceAll('_','/');
let num = str2.length%4;
if(num){
str2 += '===='.substr(num);
}
let url = CryptoJS.AES.decrypt({
ciphertext: CryptoJS.enc.Base64.parse(str2)
}, CryptoJS.enc.Hex.parse("aaad3e4fd540b0f79dca95606e72bf93"), {
mode: CryptoJS.mode.ECB,
padding: CryptoJS.pad.Pkcs7
}).toString(CryptoJS.enc.Utf8);
console.log(url);
url
if(url){
// addUri(decrypted,title)
let json ={
"url": url,
"title": title,
};
pldownarr.push(json)
if(pldownarr.length==arr.length){
console.log(pldownarr);
plaria2(-1,pldownarr);
}
}else{
Toast('解密地址失败');
}
}else{
Toast("获取下载链接失败");
}
},
onerror: function(err) {
console.log(err);
}
});
}
}
function plaria2(i,arr){
setTimeout(function(){
if(++i < arr.length){
addUri(arr[i].url,arr[i].title)
plaria2(i,arr);
console.log(i,arr.length)
}
}, Math.random() * 1000);
}
function aria2set(b){
let css= `
.layui-form{
display: flex;
margin-top: 20px;
}
.layui-form-label {
box-sizing: content-box;
}
.layui-input-block p{
font-size:12px
}
.layui-form-item{
margin-bottom:5px
}
.layui-input-block{
min-height:auto;
}
.main-left{
width: 347px;
}
.scan{
width:200px;
display:inline-block;
text-align: center;
margin-right: 40px;
}
.scan img{
width: 140px;
margin: 0 5px 10px 5px;
}
.scan h1{
font-size: 18px;
font-weight: bold;
margin: 0px 0 20px 0;
}
.scan p{
margin: 0;
color: #666;
font-size: 14px;
}
.layui-layer-btn0{
border: 1px solid #dedede!important;
background-color: #fff!important;
color: #333!important;
}
.layui-layer-btn1{
border-color: #1E9FFF!important;
background-color: #1E9FFF!important;
color: #fff!important;
}
`;
GMaddStyle(css);
document.querySelector("#aria2set") .addEventListener('click',function() {
let rpc="ws://localhost:6800/jsonrpc";
if(GMgetValue("rpc")!=null){
rpc= GMgetValue("rpc")
}
let token="";
if(GMgetValue("token")!=null){
token= GMgetValue("token")
}
let mulu="D:/";
if(GMgetValue("mulu")!=null&&GMgetValue("mulu")!=""){
mulu= GMgetValue("mulu")
}
let plcode="";
if(GMgetValue("plcode")!=null){
plcode= GMgetValue("plcode")
}
let contenthtml ="";
contenthtml +=''
contenthtml +=''
layer.open({
type: 1,
area: ['580px', '450px'],
title: "批量下载设置",
shade: 0,
id:"biliset",
btnAlign: 'c',
btn: ['取消', '保存设置'],
content:contenthtml
, btn2: function(index, layero) {
layero.find("input").each(function() {
if (this.getAttribute("name") == "rpc") {
GMsetValue("rpc",this.value);
}
else if (this.getAttribute("name") == "token") {
GMsetValue("token",this.value);
}
else if (this.getAttribute("name") == "mulu") {
GMsetValue("mulu",this.value);
}
else if (this.getAttribute("name") == "plcode") {
if(this.value != ""){
GMsetValue("plcode",this.value);
}else{
GMsetValue("plcode","");
Toast('请在脚本设置里输入验证码!');
}
}
});
}
});
});
document.querySelector("#all") .addEventListener('click',function() {
b.forEach(function(element) {
element.checked = true;
})
Toast("已经全部选择",3000)
});
document.querySelector("#delall") .addEventListener('click',function() {
b.forEach(function(element) {
element.checked = false;
});
Toast("已经全部取消选择",3000)
});
}
function douyinbtn(d) {
let downhtml = '';
let iCount;
console.log(d);
let DYPromise = new Promise(function(resolve, reject){
iCount = setInterval(function() {
var a = document.querySelector(nodeid);
if(a != null ){
resolve(a)
}
console.log("监听")
},1000);
});
DYPromise.then(function(msg){
clearInterval(iCount);
var b = document.createElement('xg-icon');
b.innerHTML = downhtml;
b.setAttribute("class","xgplayer-autoplay-setting automatic-continuous");
b.setAttribute("id","downvideo");
document.querySelector(nodeid).appendChild(b);
getdouyinvideo(d)
});
}
function getdouyinvideo(d){
document.querySelector('#downvideo').addEventListener('click',function() {
Toast("正在获取视频文件",3000)
if (d != "") {
GM_xmlhttpRequest({
method: "GET",
url: "http://tool.zhihupe.com/douyin/api.php?videoid=" + d,
headers: {
"Content-Type": "text/html; charset=utf-8"
},
onload: function(res) {
var json=JSON.parse(res.responseText);
var filename = d+".mp4";
var url = json.downurl
console.log(json);
if (json.code == 1) {
Toast("视频获取成功",3000)
ToastDwon(url,filename);
}else{
Toast("视频文件获取失败",3000)
}
},
onerror: function(err) {
console.log(err);
}
});
} else {
console.log('视频id为空!');
}
});
}
function kuaishoubtn(d) {
let downhtml = '下载
';
let iCount;
let KsPromise = new Promise(function(resolve, reject){
iCount = setInterval(function() {
var a = document.querySelector(nodeid);
if(a != null ){
resolve(a)
}
console.log(a)
},1000);
});
KsPromise.then(function(msg){
clearInterval(iCount);
var b = document.createElement('div');
b.innerHTML = downhtml;
b.setAttribute("class","kwai-player-volume-container player-bar-volume show-volume-slide");
b.setAttribute("data-v-0c78ed39","");
b.setAttribute("data-v-5037d859","");
b.setAttribute("data-v-2475c26c","");
b.setAttribute("data-v-56544f8e","");
b.setAttribute("id","downvideo");
let node = document.querySelector(nodeid)
node.insertBefore(b,node.childNodes[0]);
if(playhref.indexOf("short-video")!=-1){
var e = document.querySelector(".total")
e.style.right ="180px"
var f = document.querySelector(".player-bar-progress")
f.style.width ="calc(100% - 318px)";
}
getksvideo(d)
});
}
function getksvideo(d){
document.querySelector('#downvideo').addEventListener('click',function() {
Toast("正在获取视频文件",1000)
let videonode = document.querySelector("video")
let src =videonode.getAttribute("src")
let pausebtn = document.querySelector(".pause-icon");
if(pausebtn != null){
pausebtn.click();
}
if(src.indexOf("blob:") != -1){
GM_xmlhttpRequest({
url:"https://www.kuaishou.com/graphql",
method :"POST",
data:'{"operationName":"visionVideoDetail","variables":{"photoId":"'+d+'","page":"detail"},"query":"query visionVideoDetail($photoId: String, $type: String, $page: String, $webPageArea: String) {\\n visionVideoDetail(photoId: $photoId, type: $type, page: $page, webPageArea: $webPageArea) {\\n status\\n type\\n author {\\n id\\n name\\n following\\n headerUrl\\n __typename\\n }\\n photo {\\n id\\n duration\\n caption\\n likeCount\\n realLikeCount\\n coverUrl\\n photoUrl\\n liked\\n timestamp\\n expTag\\n llsid\\n viewCount\\n videoRatio\\n stereoType\\n croppedPhotoUrl\\n manifest {\\n mediaType\\n businessType\\n version\\n adaptationSet {\\n id\\n duration\\n representation {\\n id\\n defaultSelect\\n backupUrl\\n codecs\\n url\\n height\\n width\\n avgBitrate\\n maxBitrate\\n m3u8Slice\\n qualityType\\n qualityLabel\\n frameRate\\n featureP2sp\\n hidden\\n disableAdaptive\\n __typename\\n }\\n __typename\\n }\\n __typename\\n }\\n __typename\\n }\\n tags {\\n type\\n name\\n __typename\\n }\\n commentLimit {\\n canAddComment\\n __typename\\n }\\n llsid\\n danmakuSwitch\\n __typename\\n }\\n}\\n"}'
,headers: {
"Content-type": "application/json"
},
onload: function(res) {
let obj=JSON.parse(res.responseText)
let src=obj.data.visionVideoDetail.photo.photoUrl;
if(res===null){
console.log('失败的id"',d)
}
Toast("视频获取成功",1000)
ToastDwon(src,d)
},
onerror: function(err) {
console.log(err);
}
});
}else{
Toast("视频获取成功",1000)
ToastDwon(src,d)
}
})
}
function xiguabtn(d) {
let downhtml = '下载';
let iCount;
console.log(d);
var a = document.querySelector(nodeid);
if(a != null ){
var b = document.createElement('button');
b.innerHTML = downhtml;
b.setAttribute("class","video_action_item video_action_item--report video_action_item--triggerAnyWhere");
b.setAttribute("id","downvideo");
a.appendChild(b);
getxgvideo(d)
}
}
function getxgvideo(d){
if(playhref){
document.querySelector('#downvideo').addEventListener('click',function() {
Toast("正在获取视频文件",1000)
GM_xmlhttpRequest({
url:"http://47.99.158.118/video-crack/v2/parse?content="+window.location.href,
method :"POST",
headers: {
"Content-type": "application/json"
},
onload: function(res) {
let obj=JSON.parse(res.responseText)
if(obj.code == 0){
Toast("视频获取成功",1000)
ToastDwon(obj.data.url,d)
}else {
ToastDwon("此视频不支持解析")
}
},
onerror: function(err) {
console.log(err);
}
});
})
}
}
function ToastDwon(videourl,filename) {
var m = document.createElement('div');
m.innerHTML =' 下载视频
';
m.setAttribute('id','dwon');
m.style.cssText = "max-width: 480px;min-width: 150px;padding: 0 25px;height: 200px;color: #323442;line-height: 20px;border-radius: 4px;position: fixed;top: 50%;left: 50%;transform: translate(-50%, -50%);z-index: 999998;background: #f8f9fd;font-size: 16px;";
document.body.appendChild(m);
document.querySelector("#close").addEventListener('click',function() {
document.body.removeChild(document.querySelector("#dwon"))
})
document.querySelector("#videofile").addEventListener('click',function() {
Toast("创建下载需要时间,长时间未创建,点击浏览器打开,右键另存为",4000)
// GM_download({
// url:videourl+'.mp4',
// name: filename,
// saveAs: true, //布尔值,显示"保存为"对话框
// onerror: function (error) {
// Toast("下载出错,点击浏览器打开手动保存",3000)
// },
// onprogress: (pro) => {
// },
// ontimeout: () => {
// //如果此下载由于超时而失败,则要执行的回调
// Toast("下载超时,点击浏览器打开手动保存",3000)
// },
// onload: () => {
// Toast("下载完成",3000)
// }
// })
fetch(videourl+'.mp4').then(res => res.blob()).then(blob => {
const a = document.createElement('a');
document.body.appendChild(a)
a.style.display = 'none'
const url = window.URL.createObjectURL(blob);
a.href = url;
a.download = filename;
a.click();
document.body.removeChild(a)
window.URL.revokeObjectURL(url);
});
})
}
function addUri(u,t) {
//配置
return new Promise(function(resolve, reject) {
var wsurl = GMgetValue("rpc");;
var uris = [u];
var token="";
var filename = t
if(GMgetValue("mulu")!=null&&GMgetValue("mulu")!=""){
var mulu= GMgetValue("mulu")
}else{
mulu ="D:/"
}
var options = {
"dir":mulu,
"max-connection-per-server": "16",
"header": [ "User-Agent: "+UA, "Referer: "+playhref ]
};
if (filename != "") {
options.out = filename;
}
var json = {
"id": "zhihu",
"jsonrpc": '2.0',
"method": 'aria2.addUri',
"params": [uris, options],
};
console.log(json)
if (token != "") {
json.params.unshift("token:" + token); // 坑死了,必须要加在第一个
}
var ws = new WebSocket(wsurl);
ws.onerror = event => {
console.log(event);
Toast('连接错误, Aria2 连接错误,请检查RPC设置!');
};
ws.onopen = () => { ws.send(JSON.stringify(json)); }
ws.onmessage = event => {
let received_msg = JSON.parse(event.data);
console.log(received_msg);
if (received_msg.error !== undefined) {
if (received_msg.error.code === 1)Toast('通过RPC连接失败', '请打开控制台查看详细错误信息,返回信息:' + received_msg.error.message);
}
resolve();
switch (received_msg.method) {
case "aria2.onDownloadStart":
Toast("Aria2 发送成功, "+filename+" 已经开始下载!",1000);
ws.close();
break;
default:
break;
}
// version = received_msg.result.version;
};
});
}
// Your code here...
})();